/* 导入github-markdown-css */
@import 'github-markdown-css/github-markdown.css';

/* 自定义覆盖样式 */
.markdown-body {
    background-color: transparent !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji' !important;
}

/* 优化链接样式 */
.markdown-body a,
.markdown-body .markdown-link {
    color: #4f46e5 !important;
    text-decoration: none !important;
    border-bottom: 1px solid #c7d2fe !important;
    transition: all 0.2s ease-in-out !important;
    cursor: default !important;
}

.markdown-body a:hover,
.markdown-body .markdown-link:hover {
    color: #4338ca !important;
    border-bottom-color: #818cf8 !important;
}

.markdown-body img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1rem auto;
    border-radius: 0.375rem;
}

.markdown-body pre {
    border-radius: 0.375rem;
    padding: 1rem;
    overflow-x: auto;
}

.markdown-body code {
    border-radius: 0.25rem;
    padding: 0.2em 0.4em;
    font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
}

/* 增强表格样式 */
.markdown-body table {
    display: table !important;
    width: 100% !important;
    table-layout: fixed !important;
    border-collapse: collapse !important;
    margin: 16px 0 !important;
    border: 1px solid #dfe2e5 !important;
    border-spacing: 0 !important;
    overflow: visible !important;
    font-size: 14px !important;
    text-align: left !important;
}

.markdown-body table th {
    font-weight: 600 !important;
    padding: 10px !important;
    background-color: #f6f8fa !important;
    border: 1px solid #dfe2e5 !important;
    color: #24292e !important;
    text-align: left !important;
    word-break: break-word !important;
}

.markdown-body table tr {
    background-color: #fff !important;
    border-top: 1px solid #c6cbd1 !important;
}

.markdown-body table tr:nth-child(2n) {
    background-color: #f6f8fa !important;
}

.markdown-body table td {
    padding: 10px !important;
    border: 1px solid #dfe2e5 !important;
    word-break: break-word !important;
    vertical-align: middle !important;
}

/* 表格响应式处理 */
@media (max-width: 768px) {
    .markdown-body table {
        display: block !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .markdown-body table th,
    .markdown-body table td {
        padding: 8px !important;
        font-size: 13px !important;
    }
}

.markdown-body blockquote {
    border-left-width: 4px;
    padding-left: 1rem;
    color: #4a5568;
}

/* 确保内容自适应 */
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
    margin-top: 1.5em;
    margin-bottom: 1em;
    font-weight: 600;
    line-height: 1.25;
}

.markdown-body h1 {
    font-size: 2em;
}

.markdown-body h2 {
    font-size: 1.5em;
}

.markdown-body h3 {
    font-size: 1.25em;
}

.markdown-body h4 {
    font-size: 1em;
}

.markdown-body h5 {
    font-size: 0.875em;
}

.markdown-body h6 {
    font-size: 0.85em;
}

.markdown-body p,
.markdown-body ul,
.markdown-body ol {
    margin-top: 0;
    margin-bottom: 16px;
    line-height: 1.6;
}

/* 添加列表样式 */
.markdown-body ul,
.markdown-body ol {
    padding-left: 1.2em !important;
    list-style-position: outside !important;
}

.markdown-body ul li,
.markdown-body ol li {
    margin: 0.25em 0 !important;
    padding-left: 0.3em !important;
}

.markdown-body li>p {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

.markdown-body li+li {
    margin-top: 0.25em !important;
}

.markdown-body ul li::marker,
.markdown-body ol li::marker {
    color: #666 !important;
}

/* 添加代码高亮样式 */
.markdown-body pre code {
    display: block;
    overflow-x: auto;
    padding: 1em;
    background: #f6f8fa;
    border-radius: 0.3em;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .markdown-body {
        font-size: 0.875rem;
    }

    .markdown-body h1 {
        font-size: 1.75em;
    }

    .markdown-body h2 {
        font-size: 1.375em;
    }

    .markdown-body h3 {
        font-size: 1.125em;
    }

    .markdown-body h4 {
        font-size: 1em;
    }
}

/* Compact模式样式 */
.markdown-body.compact {
    font-size: 0.875rem;
    line-height: 1.5;
}

.markdown-body.compact h1 {
    font-size: 1.5em;
    margin-top: 1.2em;
    margin-bottom: 0.8em;
}

.markdown-body.compact h2 {
    font-size: 1.25em;
    margin-top: 1.1em;
    margin-bottom: 0.7em;
}

.markdown-body.compact h3 {
    font-size: 1.1em;
    margin-top: 1em;
    margin-bottom: 0.6em;
}

.markdown-body.compact h4 {
    font-size: 1em;
    margin-top: 0.9em;
    margin-bottom: 0.5em;
}

.markdown-body.compact h5 {
    font-size: 0.875em;
    margin-top: 0.8em;
    margin-bottom: 0.4em;
}

.markdown-body.compact h6 {
    font-size: 0.85em;
    margin-top: 0.7em;
    margin-bottom: 0.3em;
}

.markdown-body.compact p {
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

.markdown-body.compact ul,
.markdown-body.compact ol {
    margin-top: 0.5em;
    margin-bottom: 0.5em;
    padding-left: 1.2em;
}

.markdown-body.compact li {
    margin: 0.2em 0;
}

.markdown-body.compact blockquote {
    margin: 0.8em 0;
    padding: 0.5em 1em;
    border-left-width: 3px;
    background-color: #f8fafc;
}

.markdown-body.compact code {
    padding: 0.15em 0.3em;
    font-size: 0.9em;
}

.markdown-body.compact pre {
    margin: 0.8em 0;
    padding: 0.8em;
}